<!--订单管理-->
<template>
  <div>
    <Table
      :columns="columns"
      :data="tableData.list"
      :total="tableData.total"
      :pageSize="tableData.pageSize"
      :pageNum="tableData.pageNum"
      :isShowPagination="true"
    >
      <template #btnSlot="{ scope }">
        <el-button size="small" type="warning" @click="addPackage(scope.row)">{{
          $t('om.ViewDetails')
        }}</el-button>
        <el-button size="small" type="primary" @click="addPackage(scope.row)">{{
          $t('om.Pay')
        }}</el-button>
        <el-button size="small" type="danger" @click="addPackage(scope.row)">{{
          $t('om.CancelOrder')
        }}</el-button>
        <el-button size="small" type="primary" @click="addPackage(scope.row)">发票</el-button>
      </template>
    </Table>
  </div>
</template>
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import Table from '@/components/Table/index.vue';
import { getPcbSmtList } from '@/server/api/biz.js';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const columns = computed(() => [
  {
    label: t('om.OrderNo'),
    prop: 'serial',
  },
  {
    label: t('om.OrderInfo'),
    prop: 'items',
  },
  {
    label: t('smt.Ordertime'),
    prop: 'createTime',
  },
  {
    label: t('om.Postal'),
    prop: 'mails',
  },
  {
    label: t('om.Estimateddelivery'),
    prop: 'deliveryDay',
  },
  {
    label: t('om.Prices'),
    prop: 'orderAmount',
  },
  {
    label: t('om.OrderStatus'),
    prop: 'orderStatus',
  },
  {
    label: t('om.OrderOperation'),
    type: 'btn',
  },
]);

const tableData = reactive({
  list: [],
  total: 0,
  pageNum: 1,
  pageSize: 10,
});

const getList = () => {
  const obj = {
    bomSource: 0,
    bomStatus: 0,
    contractId: 0,
    customerAccountId: 0,
    customerId: 0,
    endTime: '',
    limit: 10,
    orderCategory: 2,
    orderLevel: 0,
    orderProgress: 0,
    orderQuoteType: 0,
    orderSource: 1,
    orderStatus: 0,
    orderType: 0,
    page: 1,
    pageType: 1,
    patchStatus: 0,
    pcbStatus: 0,
    serial: '',
    smtLayer: 0,
    startTime: '',
  };
  getPcbSmtList(obj).then((res) => {
    if (res.code === 200) {
      console.log(res);
      tableData.list = res.data.list;
      tableData.total = res.data.total;
    }
  });
};

onMounted(() => {
  getList();
});
</script>
<style lang="scss" scope>
.el-button + .el-button {
  margin-left: 0px;
  margin: 5px 0px;
}
</style>
